import Taro, { Component } from '@tarojs/taro'
import {View,Text,Image} from '@tarojs/components'
import './index.css'
import { AtAvatar,AtGrid, AtList, AtListItem, AtTabBar } from 'taro-ui'
import {$navigateTo, $redirectTo,getGlobalData} from '../../../global'
import app from '../../../main.js'

export default class index extends Component {
  config = {
    navigationBarTitleText: '个人中心'
  }
  constructor () {
    super(...arguments)
    this.state = {
      value: '',
      current: 1
    }
  }
  handleClick (value) {
      this.setState({
          current: value
      })
      if (value == 0) {
          app.redirectTo("../huanzheshouye/huanzheshouye")
      } else if (value == 1) {
          app.redirectTo("../gerenzhongxinzhuye/index")
      }
  }
  geren=(item,index)=>{
    switch(index){
        case 0:$navigateTo('../chengyuanliebiao/index');
        break;
        case 1:$navigateTo('../chooseexpert/chooseexpert?type=center');
        break;
        case 2:$navigateTo('../wenzhenliebiao/index');
        break;
        case 3:$navigateTo('../dingdanliebiao/index');
        break;
        case 4:$navigateTo('../wodeyouhuiquan/index');
        break;
    }
  }
  componentWillMount () { }

  componentDidMount () { }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }
  
  handleChange (value) {
    this.setState({
      value,
  
    })
  }
  
  render () {
    return (
    <View className='index'>
      <View className='b'>
      <AtList hasBorder={false}>
        <AtListItem
          title='江小白'
          note='135265152157'
          thumb={getGlobalData('baseurl')+'img/88bed02de4bb674e08aa00b2fdbca6cc.jpg'}
          hasBorder={false}
        />
        </AtList>
      </View>
      <AtGrid onClick={this.geren} className='a' data={
        [
          {
            image:getGlobalData('baseurl')+'img/jiangkangdangan.png',
            value: '健康档案'
          },
          {
            image: getGlobalData('baseurl')+'img/wodeyisheng.png',
            value: '我的医生'
          },
          {
            image: getGlobalData('baseurl')+'img/wodetingzhen.png',
            value: '我的问诊'
          },
          {
            image: getGlobalData('baseurl')+'img/wodedingdan.png',
            value: '我的订单'
          },
          {
            image: getGlobalData('baseurl')+'img/wodeyouhuiquan.png',
            value: '我的优惠券'
          },
          
        ]
      } />
      <AtTabBar
        fixed
        tabList={[
        { title: '首页', iconType: 'home' },
        { title: '个人中心', iconType: 'user' }
        ]}
        onClick={this.handleClick.bind(this)}
        current={this.state.current}
      />
    </View>
    )
    
  }
  

}

